namespace SmartSoft.ADP
{
    using System;
    using System.Data;
    using System.Data.SqlClient;

    public class CDSLCKDataAccess
    {
        private WSCDSLCKDataAccess.WSCDSLCKDataAccess wDataAcess = new WSCDSLCKDataAccess.WSCDSLCKDataAccess();
        private SmartSoft.DAL.CDSLCKDataAccess oDataAcess = new SmartSoft.DAL.CDSLCKDataAccess();

        public CDSLCKDataAccess()
        {
            wDataAcess.Url = wDataAcess.Url.Replace("localhost", AdapterInstance.ServerIp);
        }

        public DataSet GetDataSet(string ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2)
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                return wDataAcess.GetDataSet(ps_Subsidiary, pd_Ngay_Ct1, pd_Ngay_Ct2);
            }
            else
            {
                return oDataAcess.GetDataSet(ps_Subsidiary, pd_Ngay_Ct1, pd_Ngay_Ct2);
            }
        }

        public bool Save(string ps_Subsidiary, object pd_Ngay_Ct2, DataSet po_DataSet)
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                return wDataAcess.Save(ps_Subsidiary, pd_Ngay_Ct2, po_DataSet);
            }
            else
            {
                return oDataAcess.Save(ps_Subsidiary, pd_Ngay_Ct2, po_DataSet);
            }

        }
    }
}